package com.lazycat.backend.controller.shop;

import com.lazycat.backend.service.impl.shop.BuySingleGoodServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class BuySingleGoodController {

    @Autowired
    private BuySingleGoodServiceImpl buySingleGoodService;
    

    //购买单个物品的接口
    @PostMapping("shop/buySingle/")
    public Map<String, Object> buySingle(@RequestBody Map<String, String> map) {
        Integer goodId = Integer.parseInt(map.get("goodId"));
        Integer buyerId = Integer.parseInt(map.get("buyerId"));
        Integer addressId = Integer.parseInt(map.get("addressId"));
        return buySingleGoodService.buy(goodId, buyerId, addressId);
    }

}
